import Mock from 'mockjs';

const list = Mock.mock({
    // 20条数据
    "data|100": [{
        'order|+1':1,
        code: new Date().getTime(),
        time: "2021年12月16日上午10:08",
        type: "青菜",
        sum: 100,
        'past_count|10-200': 10,
        'pre_count|10-100': 10, 
    }]
  })
class MockInventory{
    getInventoryList(current_page: number, page_size: number) {
        const newList = list.data.slice(
          (current_page - 1) * page_size,
          (current_page - 1) * page_size + page_size
        );
        return Promise.resolve({
          status: 0,
          result: newList,
        });
      }
    removeItem(order:number){
        console.log(order);
        
        list.data=list.data.filter((item:any)=>{
            return item.order!==order;   
        })
        return Promise.resolve({
            status:0,
            meg:'删除成功',   
        })
        
    }
}

export const mockInventory=new MockInventory();